package tehMod;

import org.lwjgl.opengl.GL11;

import net.minecraft.src.*;

public class TileEntityBannerRenderer extends TileEntitySpecialRenderer {
	
    private ModelBanner modelBanner = new ModelBanner();
    private World worldObj;
    
    public TileEntityBannerRenderer() {
    }
    
    public TileEntityBannerRenderer(World world) {
    	worldObj = world;
    }
    
    public void renderModelAt(TileEntityBanner tileentity, double x, double y, double z, float f) {
		int metadata = tileentity.getBlockMetadata();
		int angle;

		switch (metadata) {
			default:
				angle = 0;
			break;
			case 1:
				angle = 90;
			break;
			case 2:
				angle = 180;
			break;
			case 3:
				angle = 270;
			break;
		}

        bindTextureByName(mod_TehMod.textures.get("Banner"));
        GL11.glPushMatrix();
        GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
        GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F);
        GL11.glScalef(1.0F, -1F, -1F); //if you read this comment out this line and you can see what happens
        modelBanner.renderModel(0.0625F);
        GL11.glPopMatrix();

    }
	
    public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) {
        renderModelAt((TileEntityBanner)tileentity, d, d1, d2, f);
    }
}
